﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HRdex_Final.Message
{
    public partial class WebForm3 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

       
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string annsearch = TextBox1.Text;
                 SentItems.SelectCommand = "SELECT  formMessegeSender.MessageID, formMessegeSender.Subject, formMessegeSender.DateTime, formMessegeSender.AttachmentName, " +
                      "formMessegeSender.Parent, formEmployees.LastName + ', ' + formEmployees.FirstName AS fulname, catMessege.catMessegeName" +
                      "FROM formMessegeSender INNER JOIN formEmployees ON formMessegeSender.EmployeeID = formEmployees.EmployeeID INNER JOIN" +
                      "catMessege ON formMessegeSender.catMessegeID = catMessege.catMessegeID" +
                      "WHERE (formMessegeSender.fromEmpID = " + SessionID() + ") AND (formMessegeSender.Subject like '%" + annsearch + "%')";
           
        }
        string SessionID()
        {
            return Session["EmployeeID"].ToString();
        }

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Session["messageID"] = GridView1.SelectedDataKey.Value.ToString();
            Session["sent"] = "1";
            Session["new"] = "1";
            Server.Transfer("~/Message/MessageNew.aspx");
        }
        
    }
}